package com.springboot.admin.acutuator.endpoint;

import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
import org.springframework.boot.actuate.endpoint.annotation.WriteOperation;
import org.springframework.stereotype.Component;

import java.util.Collections;
import java.util.Map;

/************************************************************************
 *
 *    Copyright  Copyright 2021 Google Inc.
 *    File Name: MyServiceEndPoint
 *    Description: 描述
 *
 *    Version: V1.0
 *    Author: Fuc
 *    Create Time: 2021-01-12
 *
 *************************************************************************/

@Component
@Endpoint(id = "myService")
public class MyServiceEndPoint {

  @ReadOperation
  public Map getDockerInfo() {
    // 端点的读操作  http://localhost:8080/actuator/myService
    return Collections.singletonMap("dockerInfo", "docker started.....");
  }

  @WriteOperation
  public void stopDocker() {
    System.out.println("docker stopped.....");
  }
}
